<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../Ajs/vue.min.js"></script>
</head>
<body>
    <div id="app">
        <my-com :title="title" @add-size="fn($event)"></my-com>
    </div>

    <script>

        Vue.component("myCom",{
            data(){

            },
            props:["title"],
            template:`<div><span>{{title}}</span><br><input type='button' value='增大父组件字体大小' @click="$emit('add-size',1)"></div>`
        });
        // $emit()触发当前实例上的事件。附加参数都会传给监听器回调。

        var vm = new Vue({
            el:"#app",
            data:{
                title:"标题"
            },
            methods:{
                fn(num){
                    console.log(num);
                }
            }
        })
    </script>
</body>
</html>
